﻿Public Class Main

    Private Const STR_TEST_DATA_FILE As String = ".\testdata.xml"

    Public Shared Sub main()

        Dim rs As New ReportCriteriaDataSet
        rs.ReadXml(STR_TEST_DATA_FILE)

        Dim f As New frmCriteriaSelector
        f.setDataSource(rs)
        f.ShowDialog()

    End Sub

    Public Shared Sub CreateTestDataSet()
        Dim rs As New ReportCriteriaDataSet
        Dim dr As ReportCriteriaDataSet.ReportDefinitionRow
        Dim drc As ReportCriteriaDataSet.CriterionDefinitionRow

        dr = CType(rs.Tables(0).NewRow(), ReportCriteriaDataSet.ReportDefinitionRow)
        dr.ReportId = 1
        dr.ReportName = "Test Report 1"
        rs.ReportDefinition.Rows.Add(dr)
        rs.ReportDefinition.AcceptChanges()
        dr = Nothing
        dr = CType(rs.Tables(0).NewRow(), ReportCriteriaDataSet.ReportDefinitionRow)
        dr.ReportId = 2
        dr.ReportName = "Test Report 2"
        rs.ReportDefinition.Rows.Add(dr)

        drc = rs.CriterionDefinition.NewCriterionDefinitionRow
        drc.CriterionDefinitionId = 1
        drc.ReportId = 1
        drc.Label = "Date Criterion"
        drc.UIType = "CALENDAR"
        drc.DataType = "System.DateTime"
        rs.CriterionDefinition.Rows.Add(drc)

        drc = rs.CriterionDefinition.NewCriterionDefinitionRow
        drc.CriterionDefinitionId = 2
        drc.ReportId = 1
        drc.Label = "My Date"
        drc.UIType = "COMBOBOX"
        drc.DataType = "System.DateTime"
        rs.CriterionDefinition.Rows.Add(drc)

        rs.AcceptChanges()
        rs.WriteXml(STR_TEST_DATA_FILE)

    End Sub

End Class
